/* ----------------------------------------------------------------------
 *	Shadow Quest
 *	Copyright (C) 2009 Prageeth Silva <prageeth@thenewcoders.com>
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *  ----------------------------------------------------------------------
 */

package sq;

import org.newdawn.slick.Animation;
import org.newdawn.slick.Image;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.SpriteSheet;

public class MouseAnimation
{

	private static final int FRAME_INTERVAL = 100;
	
	private int hotX, hotY;
	private int width, height;
	private Animation display;
	
	
	public MouseAnimation() 
	throws SlickException
	{
		
	}
	
	public MouseAnimation(Image image, int width, int height, int hotX, int hotY) 
	throws SlickException
	{
		
		this();
		this.setWidth(width);
		this.setHeight(height);
		this.setHotspotX(hotX);
		this.setHotspotY(hotY);
		this.setDisplayAnimation(image);
		
	}
	
	public MouseAnimation(Image image, int width, int height) 
	throws SlickException
	{
		this(image, width, height, 0, 0);
	}
		
	public void update(int delta)
    throws SlickException
    {
		this.getDisplayAnimation().update(delta);
	}

	public Animation getDisplayAnimation() {
		return this.display;
	}

	public void setDisplayAnimation(Image image)
	{
		this.display = new Animation(new SpriteSheet(image,this.getWidth(),this.getHeight()),FRAME_INTERVAL);
		this.display.setLooping(true);
		this.display.setAutoUpdate(false);
	}

	public int getHotspotX()
	{
		return this.hotX;
	}

	public void setHotspotX(int hotX)
	{
		this.hotX = hotX;
	}

	public int getHotspotY()
	{
		return this.hotY;
	}

	public void setHotspotY(int hotY)
	{
		this.hotY = hotY;
	}

	public int getWidth()
	{
		return this.width;
	}

	public void setWidth(int width)
	{
		this.width = width;
	}

	public int getHeight()
	{
		return this.height;
	}

	public void setHeight(int height)
	{
		this.height = height;
	}
		
}
